"""The oh-so-canonical "Hello, World!" http server."""

import diesel

import eof.http as http
import eof.txbr as txbr
import eof.txbr.reactor as reactor
import eof.ztk  as ztk

ztk.loadZCML(txbr)


class WebSite(http.HTTPFactory):
	def buildProtocol(self, addr):
		channel = super().buildProtocol(addr)
		channel.requestFactory = WebRequest
		return channel


class WebRequest(http.Request):
	def process(self):
		self.write(b'hi')
		self.finish()


app = diesel.Application()
reactor.install(app)
reactor.listenTCP(8080, WebSite())
app.run()
